{% extends "cms/base.html" %}

{% block title -%}
  编辑员工
{%- endblock %}

{% block head %}
{% endblock %}

{% block page_title -%}
  {{ self.title() }}
{%- endblock %}

{% block main_content %}
  <form action="{{ url_for('cms.staff_edit', user_id=edit_user.id) }}" method="post">
    <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
    <div class="form-container">
      <div class="form-group form-inline">
        <label for="email">邮箱：</label>
        <input id="email" type="email" class="form-control" name="email" placeholder="邮箱" readonly value="{{ edit_user.email }}">
      </div>
      <div class="form-group">
        <label>员工：</label>
        <div class="form-check form-check-inline">
            <input class="form-check-input" type="radio" name="is_staff" id="staff1" value="1" {% if edit_user.is_staff %}checked{% endif%}>
              <label class="form-check-label" for="staff1" >是</label>
        </div>
        <div class="form-check form-check-inline">
          <input class="form-check-input" type="radio" name="is_staff" id="staff0" value="0"{% if not edit_user.is_staff %} checked{% endif %}>
          <label class="form-check-label" for="staff0">否</label>
        </div>
      </div>
      <div class="form-group">
        <label>角色：</label>
        {% for role in roles %}
          <div class="form-check form-check-inline">
            {% if edit_user.role.id == role.id %}
              <input class="form-check-input" type="radio" name="role" id="inlineRadio{{ loop.index }}" value="{{ role.id }}" checked>
            {% else %}
              <input class="form-check-input" type="radio" name="role" id="inlineRadio{{ loop.index }}" value="{{ role.id }}">
            {% endif %}
            <label class="form-check-label" for="inlineRadio{{ loop.index }}">{{ role.name }}</label>
          </div>
        {% endfor %}
      </div>
      <div class="form-group">
        <button class="btn btn-primary" id="submit">立即添加</button>
      </div>
    </div>
  </form>
{% endblock %}